{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set menu = 'admin_live_course' %}

{% set script_controller = 'course/live-lesson-search' %}

{% block main %}

{% if setting("course.live_course_enabled") == 1 %}

  {% include 'TopxiaAdminBundle:LiveCourse:tab.html.twig' %}
  <br>
  <form id="message-search-form" class="form-inline well well-sm mtl" action=" {{ path('admin_live_course', {status:status}) }}" method="get" novalidate>
    {% include 'OrgBundle:Org:org-tree-select.html.twig' with {orgCode: app.request.get('orgCode'), modal: 'list'} %}
    <div class="form-group">
      <select class="form-control" name="keywordType">
        {{ select_options({courseTitle:'课程名', lessonTitle: '课时名'}, app.request.get('keywordType')) }}
      </select>
    </div>
    <div class="form-group">
      <input class="form-control" type="text" placeholder="关键词" name="keyword" value="{{ app.request.get('keyword') }}">
    </div>
    <div class="form-group">
    直播开始时间:
    <input class="form-control" type="text" id="startDate" name="startDateTime" placeholder="开始时间" value="{{ app.request.get('startDateTime') }}">
    <div class="form-group">-</div>
    <input class="form-control" type="text" id="endDate" name="endDateTime" placeholder="结束时间" value="{{ app.request.get('endDateTime') }}">
    </div>
    <button class="btn btn-primary">搜索</button>
  </form>
  <input type="hidden" id="status" value="{{status}}">
  <table class="table table-striped table-hover" id="course-table">
    <thead>
    <tr>
      <th width="45%">课时</th>
      {% include 'OrgBundle:Org/Parts:table-thead-tr.html.twig' %}
      <th>直播开始时间</th>
      <th>直播时长(分)</th>
      <th>最大参与人数</th>
      {# <th>直播在线人数峰值</th> #}
    </tr>
    </thead>
    <tbody>
      {% for lesson in lessons %}
        {% set course = courses[lesson.courseId]|default(null) %}
        {% include 'TopxiaAdminBundle:LiveCourse:tr.html.twig' %}
      {% else %}
        <tr><td colspan="20"><div class="empty">暂无直播</div></td></tr>
      {% endfor %}
    </tbody>
  </table>

  {{ web_macro.paginator(paginator) }}
{% else %}
<div class="well" style="text-align:center;">


直播功能未开启，请先在<a href="{{ path('admin_setting_live_course_setting') }}"> 系统-课程设置-直播 </a>中设置开启

</div>
{% endif %}
{% endblock %}